#include <REGX52.H>
#include "timer0.h"
#include "LCD1602.h"
unsigned int sec=40,hou=23,min=59;
void main()
{
	Timer_init();
	LCD_Init();
	LCD_ShowString(1,1,"hello,jingui:");
	LCD_ShowChar(2,3,':');
	LCD_ShowChar(2,6,':');
	while(1)
	{
		LCD_ShowNum(2,1,hou,2);
		LCD_ShowNum(2,4,min,2);
		LCD_ShowNum(2,7,sec,2);
	}
}

void time0_routine() interrupt 1
{
	static unsigned int t0_count=0;
	if(1000==t0_count){
		sec++;
		t0_count=0;
		if(sec>=60){
			sec=0;
			min++;
			if(min>=60)
			{
				min=0;
				hou++;
				if(hou>=24)
				{
					hou=0;
				}
			}
		}
		
		
	}
	t0_count++;
	TH0=64535/256;
	TL0=64535%256;
}